package cn.iocoder.yudao.module.pickbook.dal.mysql.collection;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pickbook.dal.dataobject.collection.CollectionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.pickbook.controller.admin.collection.vo.*;

/**
 * 收藏 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CollectionMapper extends BaseMapperX<CollectionDO> {

    default PageResult<CollectionDO> selectPage(CollectionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CollectionDO>()
                .eqIfPresent(CollectionDO::getUserId, reqVO.getUserId())
                .eqIfPresent(CollectionDO::getBookId, reqVO.getBookId())
                .orderByDesc(CollectionDO::getId));
    }

}